<?php
	include_once ("../configs/config.php");     //配置参数
	include_once ("../common/mysql.class.php");   //MySQL操作类
	include_once ("../common/action.class.php");   //MySQL操作类
	
	$user_id = $_COOKIE['user_id'];
	$db = new action($mydbhost, $mydbuser, $mydbpw, $mydbname, "temp_conn", $mydbcharset, $mydbtag); //实例化数据库类
	
	$bottle_id = $_POST['bottle_id'];
	$page = $_POST['page'];
	
	if($page<0){
		$page=0;
		print_r(-1);
		return;
	}

	$from = $page*$message_num_onepage;
	
	$bottleinfo_list = $db->get_bottle_info($bottle_id);
	$message_list	 = $db->get_bottle_msg($bottle_id, $from, $message_num_onepage);
	
	$db->set_bottle_readed($user_id, $bottle_id);
	
	$list_length = count($message_list);
	$db->print_error("listlength:".$list_length	);
	if($list_length == 0){
		print_r(-1);
		return;
	}
	
	$return_array = array('page'=>$page,'bottle_info'=>$bottleinfo_list,'message_info'=>$message_list);
	print_r(json_encode($return_array)); 
?>
